// 动态数组
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    double *ptd;
    int max;
    int number;
    int i = 0;
    puts("please input the max number of your entries:\n");
    scanf("%d", &max);

    ptd = (double *)malloc(max * sizeof(double));
    if (ptd == NULL)
    {
        puts("Memory allocation failed.\n");
        exit(0);
    }
    puts("please input the number:\n");

    while (i < max && scanf("%lf", &ptd[i]) == 1)
    {
        ++i;
    }
    printf("Here are your %d entries:\n", number = i);

    for (i = 0; i < number; i++)
    {
        printf("%7.2f", ptd[i]);
        if (i % 5 == 4)
            putchar('\n');
    }
    putchar('\n');
    free(ptd);

    return 0;
}
